"""
Case Type   : USTORE
Case Name   : 验证参数enbale_recyclebin的异常值abc
Create At   : 2025/3/10
Owner       : wan005
Description :
    1.查询参数默认值
    2.修改参数默认值非法
    3.查询参数值
Expect      :
    1.参数默认值off
    2.修改失败
    3.参数值off
History     :
"""
import os
import unittest
import sys
from testcase.utils.Common import Common
from testcase.utils.CommonSH import CommonSH
from testcase.utils.Logger import Logger
from testcase.utils.Constant import Constant


class Security(unittest.TestCase):
    def setUp(self):
        self.logger = Logger()
        self.logger.info(f'---{os.path.basename(__file__)} start---')
        self.sh_primy = CommonSH('PrimaryDbUser')
        self.constant = Constant()
        self.common = Common()

    def test_ustore(self):
        text = '-----step1:查询参数默认值;expect:参数默认值off-----'
        self.logger.info(text)
        res1 = self.common.show_param('enable_recyclebin')
        self.assertEqual('off', res1, text + '执行失败')

        text = '-----step2:修改参数默认值非法;expect:失败-----'
        self.logger.info(text)
        err_msg = 'ERROR: The value "abc" for parameter "enable_recyclebin" ' \
                  'is incorrect, requires a boolean value'
        res2 = self.sh_primy.execute_gsguc('reload', err_msg,
                                           'enable_recyclebin=abc')
        self.assertEqual(True, res2, text + '执行失败')

        text = '-----step3:查询参数默认值;expect:参数默认值off-----'
        self.logger.info(text)
        res3 = self.common.show_param('enable_recyclebin')
        self.assertEqual('off', res3, text + '执行失败')

    def tearDown(self):
        self.logger.info(f'---{os.path.basename(__file__)} end---')
